package com.goldcn.user.controller;

import com.goldcn.user.dto.CompanyDecorationDescDto;
import com.goldcn.user.dto.CompanyDecorationSelectDto;
import com.goldcn.user.model.CompanyDecorationPage;
import com.goldcn.user.service.CompanyDecorationPageService;
import com.goldcn.user.service.CompanyDecorationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Tim Peng
 * mail: lmn_022@163.com
 * Date: 2017/10/23
 * Time: 10:34
 * To change this template use File | Settings | File Templates.
 */
@Api(value = "店铺装修管理")
@RestController
@RequestMapping(value = "/companyDecoration")
public class CompanyDecorationController {

    @Autowired
    CompanyDecorationService companyDecorationService;

    @Autowired
    CompanyDecorationPageService companyDecorationPageService;

    @ApiOperation(value = "查询店铺列表可按条件查询")
    @RequestMapping(value = "/selectAll/{pageNum}/{pageSize}", method = RequestMethod.POST)
    public Object selectListByCondition(@PathVariable int pageNum, @PathVariable int pageSize, @RequestBody CompanyDecorationSelectDto selectDto) {
        return companyDecorationService.selectAll(pageNum, pageSize, selectDto);
    }

    @ApiOperation(value = "修改店铺信息，关于我们")
    @RequestMapping(value = "/updateShopDesc", method = RequestMethod.POST)
    public Object updateShopDesc(@RequestBody CompanyDecorationDescDto descDto) {
        return companyDecorationService.updateShopDesc(descDto);
    }

    @ApiOperation(value = "修改店铺配置")
    @RequestMapping(value = "/updateDecorationPage", method = RequestMethod.POST)
    public Object updateDecorationPage(@RequestBody CompanyDecorationPage companyDecorationPage) {
        return companyDecorationPageService.updateDecorationPage(companyDecorationPage);
    }

    @ApiOperation(value = "查询店铺配置信息（包含店铺介绍）")
    @RequestMapping(value = "/selectDecorationPage/{supplierID}", method = RequestMethod.GET)
    public Object selectDecorationPage(@PathVariable Long supplierID) {
        return companyDecorationService.selectDecorationAndPage(supplierID);
    }


    @ApiOperation(value = "删除店铺配置信息page")
    @RequestMapping(value = "/delDecorationPage/{pageID}", method = RequestMethod.GET)
    public Object deleDecorationPage(@PathVariable Long pageID) {
        return companyDecorationService.delDecorationPage(pageID);
    }


    @ApiOperation(value = "查询店铺主图-形象图-介绍")
    @RequestMapping(value = "/selectView/{supplierID}", method = RequestMethod.GET)
    public Object selectView(@PathVariable Long supplierID) {
        return companyDecorationService.selectView(supplierID);
    }

}
